package cn.gson.crmdemo.model.service;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.fastjson.JSONArray;

import cn.gson.crmdemo.model.dao.OrderDao;
import cn.gson.crmdemo.model.dao.OrderesDao;
import cn.gson.crmdemo.model.dao.ReturneDao;
import cn.gson.crmdemo.model.mapper.ReturneMapper;
import cn.gson.crmdemo.model.pojo.Order;
import cn.gson.crmdemo.model.pojo.Returne;

@Service
@Transactional(rollbackFor=Exception.class)
public class ReturneService {
	@Autowired
	ReturneMapper rm;
	@Autowired
	ReturneDao rdao;
	@Autowired
	OrderesDao odao;
	//查询退货单
	public JSONArray selectthd(String rTitle,Integer rState) {
		return rm.selectthd(rTitle,rState);
	}
	public void xgzt(int a,int r,int o) {
		Returne re=rdao.findById(a).get();
		Order order = odao.findById(o).get();
		order.setODstate(4);
		re.setRState(r);
		rdao.save(re);
	}
	
}
